package com.my.test.design.strategy;

public class PayContext {

    private String name;

    private Strategy strategy;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public PayContext(String name){
        this.name = name;
    }

    public void payment(String type){
        if ("RMB".equals(type)){
            strategy = new StrategyRMB();
        } else if ("DOLLAR".equals(type)){
            strategy = new StrategyDOLLAR();
        }
        strategy.pay(this);
    }

    public void payNow(PayEnum payEnum) {
        payEnum.getStrategy().pay(this);
    }


}
